package com.thread.test11;

import java.util.concurrent.locks.ReentrantLock;

/**
 * @author bin
 * @date 2025 - 03 -12
 **/
public class MyRunnble implements Runnable {

    private User user;
    private Print print;

    public MyRunnble(User user,Print print) {
        this.print = print;
        this.user = user;
    }
    private ReentrantLock reentrantLock = new ReentrantLock();
    @Override
    public void run() {
        reentrantLock.lock();
        print.setUser(user);
        print.print();
        reentrantLock.unlock();
    }
}

